<?php 
	//首页
	session_start();
	require_once("../includes/public.inc.php");
	$type = isset($_GET['type'])?$_GET['type']:'';
	$s = isset($_GET['s'])?$_GET['s']:'';
	$openid = isset($_SESSION['openid'])?$_SESSION['openid']:'';
	$username = isset($_SESSION['username'])?trim($_SESSION['username']):'';//这些事从login_enter传过来的
	$password = isset($_SESSION['password'])?trim($_SESSION['password']):'';
	//echo $username;exit;
	if ($type=='dg')
	{
		$exist_user = mysql_fetch_array(mysql_query("select * from ".DBQIAN."daogou where username='".$username."' and password='".$password."' order by id desc limit 1"));
		$exist_open = mysql_fetch_array(mysql_query("select * from ".DBQIAN."daogou where openid='".$openid."' order by id desc limit 1"));
	}
	else
	{
		$exist_user = mysql_fetch_array(mysql_query("select * from ".DBQIAN."users where username='".$username."' and password='".$password."' order by id desc limit 1"));
		$exist_open = mysql_fetch_array(mysql_query("select * from ".DBQIAN."users where openid='".$openid."' order by id desc limit 1"));
	}
	$exsit_fwm = mysql_fetch_array(mysql_query("select * from ".DBQIAN."fwm where fwm='".$s."' order by id desc limit 1"));
	$desc = mysql_fetch_array(mysql_query("select * from ".DBQIAN."instro where id=1 order by id desc limit 1"));
	$img = mysql_query("select * from ".DBQIAN."scroll_image");
	//print_r($img);exit;
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="user-scalable=yes, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>香珀蒂</title>

<script src="js/shouy/pz-mobile.js"></script>
<script src="js/shouy/jquery-1.9.0.min.js"></script>
<script src="js/shouy/jquery.bxslider.min.js"></script>
<script type="text/javascript"> 
	var size = '4';
	if(size>1){$(document).ready(function(){$('.bxslider').bxSlider({ speed:300, pause:3000, mode:'horizontal', auto:true });});}
	function checkins(){
		pz_post("activity.asp",{mode:0},function(data){pz_box().show(data.data)},"json")
	}
	function share(){
		fenxiang.style.display='block';
	}

</script>

<link rel="stylesheet" type="text/css" href="js/shouy/index.css" media="all">
</head>
<body style="margin-top:0px;">
<div class="pz-css"> 
	<div class="index_flash">
		<div class="bx-wrapper">
	        <div>
		        <div style="max-width: 100%;" class="bx-wrapper">
			        <div style="width: 100%; overflow: hidden; position: relative; height:50%;" class="bx-viewport">
				        <ul style="width: 515%; position: relative; transition-duration: 0s; transform: translate3d(-1423px, 0px, 0px);" class="bxslider">
					         <? while($row = mysql_fetch_assoc($img)){?>   
					        	<li style="float: left; list-style: none outside none; position: relative; width: 1423px;"><img src="./<?=$row['imgurl']?>" /></li>
					         <?}?> 
				        </ul>
			        </div>
		        </div>
	        </div>
        </div>
	</div>
	<div class="pz-panel">	
		<h5>&nbsp;&nbsp;&nbsp;&nbsp;<?=$desc['descr']//iconv("gb2312","UTF-8//IGNORE",$desc['descr'])?></h5>
	</div>
 <?
	 if ($type=='dg')
	 {
 ?>
	 	<?if (($exist_user || $exist_open)){?>  
	      	<div class="pz-panel">
				<h5>尊敬的导购用户：<?=$username?>，欢迎回来！</h5>
				<div class="span12"><button onclick="location.href='person.php?type=<?=$type?>'" class="red">个人中心</button></div>
			</div>
		<? }else {?>
			 <div class="pz-panel">
				<div class="span6"><button onclick="location.href='login.php?type=<?=$type?>'">导购登录</button></div>
			    <div class="span6"><button onclick="location.href='selectregister.php'" class="red">免费注册</button></div>
			</div>
		<?}?>
 <?
	}
	else
	{
		if (($exist_user || $exist_open))
		{//逻辑混乱
			if ($exsit_fwm && $s && $exsit_fwm['hystatus'] >= 1)
			{
?>  
				<div class="frameqry">			
					<p style="margin: 2px;">防伪查询结果</p>
				</div>
				<div class="pz-panel">
					<h4>防伪码:<?=$s?></h4>
					<h5>&nbsp;&nbsp;&nbsp;&nbsp;对不起，该积分码经重复查询，如有疑问请至电公司客户服务中心！</h5>
				</div>
					
				<div class="pz-panel">
					<!--<h5>商品名称：<{$p}></h5>-->
					<h5>产品积分：<?=$exsit_fwm['credit']?>分</h5>
					<h5>积分状态：已使用</h5>
					<h4>
					</h4>
				</div>
				<div class="pz-panel">
					<h5>尊敬的会员用户：<?=$username?></h5>
					<h5>您当前可用积分：<?=$exist_user['credit']?></h5>
					<div class="span12">
						<button onclick="location.href='person.php?type=<?=$type?>'" class="red">个人中心</button>
					</div>
				</div>
			<?
				}
				elseif (($exsit_fwm && $s) && $exsit_fwm['hystatus'] == 0)
				{
			?>
					<div class="frameqry">			
						<p style="margin: 2px;">防伪查询结果</p>
					</div>
					<div class="pz-panel">
						<h4>防伪码:<?=$s?></h4>
						<h5>&nbsp;&nbsp;&nbsp;&nbsp;该积分尚未领取请点击领取，上次查询时间为<{$t}></h5>
			            <button onclick="location.href='lingqu.php?s=<?=$s?>'" class="red">领取</button>
					</div>
					
						<div class="pz-panel">
							<!--<h5>商品名称：<{$p}></h5>-->
							<h5>产品积分：<?$exsit_fwm['credit']?>分</h5>
							<h5>积分状态：未使用</h5>
							<h4></h4>
					</div>
					<div class="pz-panel">
						<h5>尊敬的会员用户：<?=$exist_user['username']?></h5>
						<h5>您当前可用积分：<?=$exist_user['credit']?></h5>
						<div class="span12"><button onclick="location.href='person.php?type=<?=$type?>'" class="red">个人中心</button></div>
					</div>
			<?
				}
				else
				{
			?>
			      	<div class="pz-panel">
						<h5>尊敬的会员用户：<?=$username?></h5>
						<h5>您当前可用积分：<?=$exist_user['credit']?></h5>
						<div class="span12"><button onclick="location.href='person.php?type=<?=$type?>'" class="red">个人中心</button></div>
					</div>
<? 
				}
			}
			else 
			{
				if (empty($exist_user) && empty($exist_open))
				{
?>
					<div class="pz-panel">
						<div class="span6"><button onclick="location.href='login.php?type=<?=$type?>'">会员登录</button></div>
					    <div class="span6"><button onclick="location.href='selectregister.php'" class="red">免费注册</button></div>
					</div>
<?
				}
			}
		}
?>

<div class="pz-panel">
	<ul class="panel-nav">
		<li><a href="http://www.sunpretty.com.cn"><div><img src="js/shouy/c_1.png"></div>官方网站</a></li>
		<?if ($type == 'dg'){?>
			<li><a href="todayenjoy.php?type=<?=$type?>"><div><img src="js/shouy/c_5.png"></div>今日分享</a></li>
			<li><a href="dgpx.php?type=<?=$type?>"><div><img src="js/shouy/c_5.png"></div>导购培训</a></li>	
		<?}else{?>
		<li><a href="zhuanqu.php?act=list"><div><img src="js/shouy/c_5.png"></div>赚取积分</a></li>
		<li><a href="creditshop.php?type=<?=$type?>"><div><img src="js/shouy/c_4.png"></div>积分商城</a></li>
		<li><a href="todayenjoy.php?type=<?=$type?>"><div><img src="js/shouy/c_5.png"></div>今日分享</a></li>
		<!--<li><a href="qd.php"><div><img src="js/shouy/c_11.png"></div>签到积分</a></li>-->
		<!-- <li><a href="themes/share.html"><div><img src="js/shouy/c_9.png"></div>产品分享</a></li> -->
		<!--<li><a href="http://mp.weixin.qq.com/s?__biz=MjM5NzM2MTY3NQ==&mid=200894334&idx=1&sn=ed9dc387452de88e4cb4ac92e2b68d88#rd"><div><img src="js/shouy/c_6.png"></div>关注微信</a></li>-->
		
	
		
		<!--<li><a href=""><div><img src="js/shouy/c_2.png"></div>微信商城</a></li>-->
		<!--<li><a href="promotion.asp"><div><img src="js/shouy/img/c_2.png"></div>优惠活动</a></li>-->
		
		<!-- <li><a href="lianxi.php"><div><img src="js/shouy/c_3.png"></div>联系我们</a></li>	-->		
		<!--weixin://contacts/profile/gh_eff04d64dc8d-->
		<?}?>
		<li><a href="product.php?type=<?=$type?>"><div><img src="js/shouy/c_9.png"></div>产品知识</a></li>
		<li><a href="lianxi.php?type=<?=$type?>"><div><img src="js/shouy/c_3.png"></div>联系我们</a></li>
	</ul>	
</div><!--weixin://profile/gh_f3b8daf67484-->
<div class="pz-panel">
<a href="tel:4009998148">
	<table width="100%">
		<tbody><tr>
		<td style="background: url('js/shouy/phone.png') no-repeat scroll 0% 0% transparent; width: 20px;"></td>
		<td style="font-size: 92%; background: url('js/shouy/ico.png') no-repeat scroll right center transparent; color: rgb(0, 0, 0); overflow: hidden;">拨打咨询电话</td>
		</tr>
	</tbody></table>
</a>
</div>
<div class="group center" style="font-size: 14px;">技术支持：<a href="http://www.xf12315.net">旭发防伪</a></div>
<div class="pz-box-mode" style="background: none repeat scroll 0% 0% rgba(0, 0, 0, 0.7);" id="fenxiang" onclick="this.style.display='none'"><img src="js/shouy/follow.png" style="width: 100%;"></div>
</div>
</body>
</html>